package factory;


import agents.AgentSearchHouse;
import extra.Position;

import interfaces.impl.agents.AgentDrawLife;
import interfaces.impl.agents.AgentMove;
import interfaces.impl.agents.AgentNormalMove;
import objects.ImageObject;
import objects.SpetialFeature;
import objects.WorldObject;

public abstract class ObjectFactory {
	
	
	
	public final static WorldObject createWorldObject(int id, Position position){
		WorldObject object= new WorldObject();
		
		object.setObjectReference(id);
		object.setImageObject(ImageObjectFactory.createImageObject(id));
		object.setPosition(position);
		
		SpetialFeature feature;
		
		switch (id){
		case Constants.OBJECT_REFERENCE_BOMBERMAN:		
			//adding actions
		
			//adding spetials features
		
			//adding agents
		
			//adding human Interactions 
			
			
			return object;
		
		case Constants.OBJECT_REFERENCE_SUGAR:
			object.setObjectReference(id);
			
			return object;
		
		case Constants.OBJECT_REFERENCE_STRAWBERRY:
			object.setObjectReference(id);
			return object;
			
		case Constants.OBJECT_REFERENCE_CASTLE_BLUE:
			
			object.setObjectReference(id);			
			
			//adding actions
			
			return object;
			
		case Constants.OBJECT_REFERENCE_CASTLE_RED:
			object.setObjectReference(id);
			
			//adding objects
			
			return object;
		case Constants.OBJECT_REFERENCE_MONEY:
			
			object.setObjectReference(id);
			
			
			return object;
			
		case Constants.OBJECT_REFERENCE_FUNGI:
			object.setObjectReference(id);
			
			return object;
			
		case Constants.OBJECT_REFERENCE_HOUSE:
			object.setObjectReference(id);
			
			//adding spetials features
			
			feature=SpetialFeatureFactory.getSpetialFeature(Constants.SPETIAL_FEATURE_NUMBER_PERSON);
			feature.setValue(0);
			object.addSpetialFeature(feature);
			
			feature=SpetialFeatureFactory.getSpetialFeature(Constants.SPETIAL_FEATURE_TOTAL_NUMBER_PERSON);
			feature.setValue(2);
			object.addSpetialFeature(feature);
			
			return object;
			
		case Constants.OBJECT_REFERENCE_BAD_HOUSE:
			object.setObjectReference(id);
				
			//adding special feat
			feature=SpetialFeatureFactory.getSpetialFeature(Constants.SPETIAL_FEATURE_NUMBER_PERSON);
			feature.setValue(0);
			object.addSpetialFeature(feature);
			
			feature=SpetialFeatureFactory.getSpetialFeature(Constants.SPETIAL_FEATURE_TOTAL_NUMBER_PERSON);
			feature.setValue(1);
			object.addSpetialFeature(feature);
			
			return object;
		case Constants.OBJECT_REFERENCE_PERSON:
			object.setObjectReference(id);
			
			//adding actions
			object.addAction(ActionFactory.getAction(Constants.ACTION_MOVE));
			object.addAction(ActionFactory.getAction(Constants.ACTION_XY_TO_MOVE));
			object.addAction(ActionFactory.getAction(Constants.ACTION_MODIFY_SPETIAL_FEATURE));
			object.addAction(ActionFactory.getAction(Constants.ACTION_GET_HOUSE));
			object.addAction(ActionFactory.getAction(Constants.ACTION_BUILD_BAD_HOUSE));
			//adding spetials features
			
			feature=SpetialFeatureFactory.getSpetialFeature(Constants.SPETIAL_FEATURE_X_TO_MOVE);
			feature.setValue(position.getX());
			object.addSpetialFeature(feature);
			
			feature=SpetialFeatureFactory.getSpetialFeature(Constants.SPETIAL_FEATURE_Y_TO_MOVE);
			feature.setValue(position.getY());
			object.addSpetialFeature(feature);
			
			object.addSpetialFeature(SpetialFeatureFactory.getSpetialFeature(Constants.SPETIAL_FEATURE_IS_MOVING));
			
			feature=SpetialFeatureFactory.getSpetialFeature(Constants.SPETIAL_FEATURE_SPEED);
			feature.setValue(0.02);
			object.addSpetialFeature(feature);
			
			feature=SpetialFeatureFactory.getSpetialFeature(Constants.SPETIAL_FEATURE_VISION_RANGE);
			feature.setValue(300);
			object.addSpetialFeature(feature);
			
			feature=SpetialFeatureFactory.getSpetialFeature(Constants.SPETIAL_FEATURE_HOUSE);
			
			feature.setValue(Constants.FALSE);
			object.addSpetialFeature(feature);
		
			//adding agents
			object.addAgent(new AgentMove());
			object.addAgent(new AgentNormalMove());
			object.addAgent(new AgentSearchHouse());
			
			//adding human Interactions 
			
			return object;
			
		case Constants.OBJECT_REFERENCE_CONSTRUIR:
			object.setObjectReference(id);
			System.out.println("construi");
			return object;
		default:
			object.setObjectReference(Constants.OBJECT_REFERENCE_BOMBERMAN);
			System.out.println("NO ENCUENTRO LA IMAGEN EN OBJECT FACTORY");
			return object;
			
		}
			
		
	}
	
	
	
	
}
